<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
    <script src="https://cdn.staticfile.net/vue/2.2.2/vue.min.js"></script>
    <style>
        /* 可以设置不同的进入和离开动画 */
        /* 设置持续时间和动画函数 */
        .slide-fade-enter-active {
            transition: all .3s ease;
        }

        .slide-fade-leave-active {
            transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
        }

        .slide-fade-enter,
        .slide-fade-leave-to

        /* .slide-fade-leave-active 用于 2.1.8 以下版本 */
            {
            transform: translateX(10px);
            opacity: 0;
        }
    </style>
</head>

<body>
    <div id="databinding">
        <button v-on:click="show = !show">点我</button>
        <transition name="slide-fade">
            <p v-if="show">菜鸟教程</p>
        </transition>
    </div>
    <script type="text/javascript">
        new Vue({
            el: '#databinding',
            data: {
                show: true
            }
        })
    </script>
</body>

</html>